{% extends "shared/layout.volt" %}
{% block footer %}
    <script type="text/javascript" src="/assets/My97DatePicker/WdatePicker.js"></script>
{% endblock %}
{% block content %}
    <h1 class="page-header">交易列表</h1>
    <div class="table-responsive">
        <div class="search-container">
            <form class="form-inline">
                <div class="form-group">
                    <label class="control-label" for="search_field">搜索字段：</label>
                    <select class="form-control input-sm" name="search_field" id="search_field" title="搜索条件">
                        <option value="transaction_id"{{ search_keyword=='transaction_id'?' selected':'' }}>交易流水号</option>
                        <option value="out_transaction_id"{{ search_keyword=='out_transaction_id'?' selected':'' }}>支付交易号</option>
                        <option value="order_no"{{ search_keyword=='order_no'?' selected':'' }}>商户订单号</option>
                    </select>
                </div>
                <div class="form-group">
                    <input type="text" class="form-control input-sm" style="width: 245px;" id="search_keyword" name="search_keyword" value="{{ search_keyword }}" placeholder="请输入关键字">
                </div>
                <div class="form-group">
                    <label class="control-label" for="trade_status">交易状态：</label>
                    <select class="form-control input-sm" name="trade_status" id="trade_status">
                        <option value="ALL">所有状态</option>
                        {% for trade_state_value,trade_state_name in trade_state_list %}
                        <option value="{{ trade_state_value }}"{{ trade_state_value==trade_status?' selected':'' }}>{{ trade_state_name }}</option>
                        {% endfor %}
                    </select>
                </div>
                <div class="form-group">
                    <label class="control-label" for="trade_channel">交易渠道：</label>
                    <select class="form-control input-sm" name="trade_channel" id="trade_channel">
                        <option value="ALL">所有状态</option>
                        {% for trade_channel_value,trade_channel_name in trade_channel_list %}
                            <option value="{{ trade_channel_value }}"{{ trade_channel_value==trade_channel?' selected':'' }}>{{ trade_channel_name }}</option>
                        {% endfor %}
                    </select>
                </div>
                <div class="form-group">
                    <label class="control-label" for="trade_state">支付时间：</label>
                    <input type="text" class="form-control input-sm" name="pay_time_start" id="pay_time_start" value="{{ pay_time_start }}" onclick="WdatePicker({maxDate:'#F{$dp.$D(\'pay_time_end\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" placeholder="开始时间"> -
                    <input type="text" class="form-control input-sm" name="pay_time_end" id="pay_time_end" value="{{ pay_time_end }}" onclick="WdatePicker({minDate:'#F{$dp.$D(\'pay_time_start\')}',dateFmt:'yyyy-MM-dd HH:mm:ss'})" placeholder="结束时间">
                </div>
                <div class="form-group">
                    <button type="submit" class="btn btn-success btn-sm">搜 索</button>
                </div>
            </form>
        </div>
        <table class="table-tidy">
            <thead class="table-tidy-head">
            <tr>
                <th style="width: 200px;">商户订单号</th>
                <th>交易流水号</th>
                <th style="width: 140px;">收款账号</th>
                <th style="width: 150px;">交易金额</th>
                <th style="width: 100px;">支付渠道</th>
                <th style="width: 140px;">创建时间</th>
                <th style="width: 140px;">支付时间</th>
                <th style="width: 90px;">交易状态</th>
                <th style="width: 80px;">操作</th>
            </tr>
            </thead>
            <tbody class="table-tidy-body">
            {% for item in Model.items %}
            <tr>
                <td>{{ item.order_no }}</td>
                <td>{{ item.transaction_id }}</td>
                <td>{{ item.pay_account }}</td>
                <td>{{ item.total_amount }} ({{ item.currency }})</td>
                <td>{{ item.trade_channel_text }}</td>
                <td>{{ item.time_start }}</td>
                <td>{{ item.time_end }}</td>
                <td class="text-center">{{ item.trade_state_text }}</td>
                <td class="text-center"><a href="{{ url('transaction/detail') }}?order_no={{ item.order_no }}">查看</a> </td>
            </tr>
            {% else %}
            <tr>
                <td colspan="10" class="text-center">没有数据</td>
            </tr>
            {% endfor %}
            </tbody>
        </table>
        <div class="page pagination">
            <?php echo $Model->getPaginate();?>
        </div>
    </div>
{% endblock %}